#pragma once
#include <iostream>

namespace umtl
{
	class memory_buffer : public std::basic_streambuf<char>
	{
	public:
		memory_buffer( char* p, size_t n );

		char const* begin_read_buffer() const;
		char const* begin_write_buffer() const;
		char const* current_write_buffer() const;
		char const* current_read_buffer() const;
	};

	class memory_stream : public std::iostream
	{
	public:
		memory_stream( memory_buffer& buffer );

		char const* begin_read_buffer() const;
		char const* begin_write_buffer() const;
		char const* current_write_buffer() const;
		char const* currnet_read_buffer() const;

	private:
		memory_buffer& buffer_;
	};
}